import React from 'react'
import PropTypes from 'prop-types'

export default function Child(props) {
  return (
    <div>
      <h3>Child</h3>
      <p>userName:{props.userName}</p>
      <p>age:{props.age}</p>
      <p>sex:{props.sex}</p>
      <p>{props.arr}</p>

    </div>
  )
}
Child.propTypes = {
  // 类型必须是字符串
  userName:PropTypes.string,
  // 类型必须是数字且不允许是undefined
  age:PropTypes.number.isRequired,
  arr:PropTypes.array
}
Child.defaultProps = {
  sex:'女'
}
